home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / devices / src / adddevice.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.4 KB  |  71 lines

  1. /*
  2.     (C) 1995, 96 AROS - The Amiga Replacement OS
  3.     $Id$
  4.     $Log$
  5.     Desc:
  6.     Lang: english
  7. */
  8. #include "exec_intern.h"
  9. #include <exec/devices.h>
  10. #include <aros/libcall.h>
  11.  
  12. /*****************************************************************************
  13.  
  14.     NAME */
  15.     #include <clib/exec_protos.h>
  16.  
  17.     __AROS_LH1(void, AddDevice,
  18.  
  19. /*  SYNOPSIS */
  20.     __AROS_LA(struct Device *, device,A1),
  21.  
  22. /*  LOCATION */
  23.     struct ExecBase *, SysBase, 72, Exec)
  24.  
  25. /*  FUNCTION
  26.     Adds a given device to the system's device list after checksumming
  27.     the device vectors. This function is not for general use but
  28.     (of course) for building devices that don't use exec's MakeLibrary()
  29.     mechanism.
  30.  
  31.     INPUTS
  32.     device - Pointer to a ready for use device structure.
  33.  
  34.     RESULT
  35.  
  36.     NOTES
  37.  
  38.     EXAMPLE
  39.  
  40.     BUGS
  41.  
  42.     SEE ALSO
  43.     RemDevice(), OpenDevice(), CloseDevice()
  44.  
  45.     INTERNALS
  46.  
  47.     HISTORY
  48.  
  49. ******************************************************************************/
  50. {
  51.     __AROS_FUNC_INIT
  52.  
  53.     /* Just in case the user forgot them */
  54.     device->dd_Library.lib_Node.ln_Type=NT_DEVICE;
  55.     device->dd_Library.lib_Flags|=LIBF_CHANGED;
  56.  
  57.     /* Build checksum for device vectors */
  58.     SumLibrary(&device->dd_Library);
  59.  
  60.     /* Arbitrate for the device list */
  61.     Forbid();
  62.  
  63.     /* And add the device */
  64.     Enqueue(&SysBase->DeviceList,&device->dd_Library.lib_Node);
  65.  
  66.     /* All done. */
  67.     Permit();
  68.     __AROS_FUNC_EXIT
  69. } /* AddDevice */
  70.  
  71.